﻿using Domain.Entity;
using System.Collections.Generic;
using Business.Abstract;
using Business.Service;
using Domain.Common;
using System;

namespace PresentationMVC.Models
{

    public class InvoiceDataModel
    {
        public InvoiceDataModel()
        {
        }

        public Invoice Invoice
        {
            get;
            set;
        }

        public string FromDate
        {
            get
            {
                DateTime dt = DateTime.Today;
                DateTime fromDate = new DateTime(dt.Year, dt.Month, 1);
                return fromDate.ToString("yyyy-MM-dd");
            }
        }

        public string ToDate
        {
            get
            {
                return DateTime.Today.ToString("yyyy-MM-dd");
            }
        }
       
        public IList<Invoice> AllInvoice
        {
            get;
            set;
        }

        public virtual JobBooking JobBooking
        {
            get;
            set;
        }

        public IList<JobBooking> JobBookingByInvoiceId
        {
            get;
            set;
        }
        
        public IList<KeyValPair> CustomerCombo
        {
            get
            {
                ICustomerService srv = new CustomerServiceImpl();
                IList<Customer> lstCustomer = srv.GetAllCustomers();

                IList<KeyValPair> lst = new List<KeyValPair>();
                lst.Add(new KeyValPair { Key = "0", Value = "First Name - Company Name" });

                foreach (Customer cus in lstCustomer)
                {
                    KeyValPair kvp = new KeyValPair();
                    kvp.Key = cus.ID.ToString();
                    kvp.Value = string.Concat(cus.FirstName, " - ", cus.CompanyName);
                    lst.Add(kvp);
                }
                return lst;
            }
        }

        public InvoiceSearchModel InvoiceSearch
        {
            get;
            set;
        }

    }

    public class InvoiceSearchModel
    {
        public long CustomerID
        {
            get;
            set;
        }

        public string FromDate
        {
            get;
            set;
        }

        public string ToDate
        {
            get;
            set;
        }
    }
}

